<!DOCTYPE html>
<html>
<head>
    <title>备件需求计划</title>
    #parse("sys/header.html")
    <style>
        .details td, .details th {
            vertical-align: text-bottom;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="3">
                    <i-select v-model="q.organId" placeholder="请选择所属车间">
                        <i-option v-for="workshop in workshopList" :value="workshop.deptId" :key="workshop.deptId">
                            {{workshop.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.planCode" @on-enter="query" placeholder="计划编码"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.organName" @on-enter="query" placeholder="编制人"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.erpCode" @on-enter="query" placeholder="ERP编码"></i-input>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.planType" placeholder="请选择计划类别">
                        <i-option v-for="planType in planTypeList" :value="planType.value" :key="planType.value">
                            {{planType.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("sparepartrequ:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;创建需求计划</i-button>
                #end
                #if($shiro.hasPermission("sparepartrequ:save"))
                <i-button type="info" @click="overview"><i class="fa fa fa-eye"></i>&nbsp;需求计划初稿概览</i-button>
                #end
                #if($shiro.hasPermission("sparepartrequ:save"))
                <i-button type="info" @click="commit"><i class="fa fa-upload"></i>&nbsp;提交审核</i-button>
                <i-button type="error" @click="cancel"><i class="fa fa-trash-o"></i>&nbsp;取消审核</i-button>
                #end
                #if($shiro.hasPermission("sparepartrequ:export"))
                <i-button type="warning" @click="exportData"><i class="fa fa-hand-o-up"></i>&nbsp;导出</i-button>
                #end
                #if($shiro.hasPermission("sparepartrequ:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <table id="jqGrid"></table>
    </div>
    <!-- 新增备件需求计划区域 -->
    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form :label-width="120">
            <Row>
                <i-col span="6">
                    <Form-item label="编制计划月份" prop="organMonth">
                        <Date-picker type="month" v-model="sparePartRequ.organMonth" placeholder="编制计划月份"></Date-picker>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="6">
                    <Form-item label="计划类别" prop="planType">
                        <i-select v-model="sparePartRequ.planType">
                            <i-option v-for="planType in planTypeList" :value="planType.value" :key="planType.value">
                                {{planType.name}}
                            </i-option>
                        </i-select>
                    </Form-item>
                </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="createNeedsPlan">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px">返回</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!-- 审批人员列表 -->
    <div id="audit" style="display: none;padding:20px;">
        <template>
        <i-form :label-width="80">
            <Form-item label="部门审批" prop="zhuguanshenpiren">
                <i-col span="11">
                    <i-select v-model="approveParam.zhuguanshenpiren" class="form-input" placeholder="请选择车间业务主管或技术室主任" clearable style="width:300px">
                        <i-option v-for="approver in approverList" :value="approver.userId" :key="approver.userId">
                            {{approver.nickName + '（' + approver.userName + '）'}}
                        </i-option>
                    </i-select>
                </i-col>
            </Form-item>
            <Form-item label="车间审批" prop="chejianjinglishenpiren">
                <i-col span="11">
                    <i-select v-model="approveParam.chejianjinglishenpiren" class="form-input" placeholder="请选择车间经理" clearable style="width:300px">
                        <i-option v-for="approver in approverList" :value="approver.userId" :key="approver.userId">
                            {{approver.nickName + '（' + approver.userName + '）'}}
                        </i-option>
                    </i-select>
                </i-col>
            </Form-item>
            <Form-item label="制造处审批" prop="zhizaochupeshenpiren">
                <i-col span="11">
                    <i-select v-model="approveParam.zhizaochupeshenpiren" class="form-input" placeholder="请选择制造处PE业务分管人员" clearable style="width:300px">
                        <i-option v-for="approver in approverList" :value="approver.userId" :key="approver.userId">
                            {{approver.nickName + '（' + approver.userName + '）'}}
                        </i-option>
                    </i-select>
                </i-col>
            </Form-item>
        </i-form>
        </template>
    </div>
    <!-- 审核列表区域 -->
    <div id="auditHistoryArea" style="display: none;">
        <i-table border :columns="auditTableColumns" :data="auditTableData"></i-table>
    </div>
</div>
<script src="${rc.contextPath}/js/spare/sparepartrequ.js?_${date.systemTime}"></script>
</body>
</html>
